package edu.wit.system.domain.dto;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import edu.wit.common.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
//import org.springframework.security.core.context.SecurityContextHolder;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 *
 *
 * @author yyh
 * @email 664287382@qq.com
 * @date 2021-05-26 11:45:36
 */
@Data
@ApiModel(value = "返回类")
public class AffairsApplyWorkflowDto implements Serializable {

	private static final long serialVersionUID = 1L;

	/**
	 *
	 */
	@JsonSerialize(using=ToStringSerializer.class)
	@ApiModelProperty(value = "申请ID")
	private Long applyId;
	/**
	 *
	 */
	@JsonSerialize(using=ToStringSerializer.class)
	@ApiModelProperty(value = "流程ID")
	private Long workflowId;
	/**
	 *
	 */
	@ApiModelProperty(value = "流程类型")
	private String workflowType;
	/**
	 *
	 */
	@ApiModelProperty(value = "流程名称")
	private String workflowName;
	/**
	 *
	 */
	@ApiModelProperty(value = "流程描述")
	private String workflowRemark;
	/**
	 *
	 */
	@JsonSerialize(using=ToStringSerializer.class)
	@ApiModelProperty(value = "所属学校ID")
	private Long schoolId;
	/**
	 *
	 */
	@ApiModelProperty(value = "所属学校名称")
	private String schoolName;
	/**
	 *
	 */
	@JsonSerialize(using=ToStringSerializer.class)
	@ApiModelProperty(value = "申请人ID")
	private Long applyUserId;
	/**
	 *
	 */
	@ApiModelProperty(value = "申请人姓名")
	private String applyUserName;
	/**
	 *
	 */
	@ApiModelProperty(value = "申请时间")
	private Date applyTime;
	/**
	 *
	 */
	@ApiModelProperty(value = "申请原因")
	private String applyReason;
	/**
	 *
	 */
	@ApiModelProperty(value = "开始时间")
	private Date startTime;
	/**
	 *
	 */
	@ApiModelProperty(value = "结束时间")
	private Date endTime;
	/**
	 *
	 */
	@ApiModelProperty(value = "申请状态(1:待审核,2:审核中,3:已通过,4:未通过,5:已撤销)")
	private String applyStatus;

	@ApiModelProperty(value = "附件信息")
	private String attachInfo;

	@ApiModelProperty(value = "劳务公司id")
	private String companyId;

	@ApiModelProperty(value = "劳务公司名称")
	private String companyName;

	public String getApplyUserName() {
		if(StringUtils.isNotNull(getApplyUserId())) {
//			System.out.println("AffairsApplyWorkflowDto--getApplyUserName-"+getApplyUserId());
//			System.out.println(UserUtils.selectNameByUserId(getApplyUserId()));
//			setApplyUserName(UserUtils.selectNameByUserId(getApplyUserId()));
		}
		return applyUserName;
	}

	List<AffairsApplyWrokflowNodeDto> workflowNodeList;

	AffairsApplyWrokflowNodeDto currentWorkflowNode;

	/*************************字典值*********************************/
	/**
	 *
	 */
	@ApiModelProperty(value = "流程类型")
	private String workflowTypeText;

	public String getWorkflowTypeText() {
		if(StringUtils.isNotBlank(getWorkflowType())) {
//			setWorkflowTypeText(DicUtil.viewByCode(AffairsConstant.WORKFLOW_TYPE, getWorkflowType()));
			//todo 从redis缓存取工作流类似设置
		}
		return workflowTypeText;
	}

	/**
	 *
	 */
	@ApiModelProperty(value = "申请状态(1:待审核,2:审核中,3:已通过,4:未通过,5:已撤销)")
	private String applyStatusText;

	public String getApplyStatusText() {
		if(StringUtils.isNotBlank(getApplyStatus())) {
//			setApplyStatusText(DicUtil.viewByCode(AffairsConstant.APPLY_STATUS, getApplyStatus()));
			//todo 从redis缓存取工作流类似设置
		}
		return applyStatusText;
	}

	private List<ApplyAttachDto> attachList;

	@ApiModelProperty(value = "当前任是否可以审核")
	private Boolean canCheck;

	@ApiModelProperty(value = "当前人员id")
	@TableField(exist = false)
	private String personId;

	@ApiModelProperty(value = "劳务代发专属人员ids")
	@TableField(exist = false)
	private List<Long> personIds;

}

